import redis



class Config:
    '''配置参数'''
    SECRET_KEY = 'SFHK3h23i@@%dfasdf' # 任意指定
    # 数据库
    SQLALCHEMY_DATABASE_URI = 'mysql://root:123456@127.0.0.1:3306/ihome'
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    # redis
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    # session
    SESSION_TYPE = 'redis'
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True # 对session_id隐藏
    PERMANENT_SESSION_LIFETIME = 86400 # session有效期


class DevConfig(Config):
    '''开发环境的配置信息'''
    DEBUG = True


class ProductConfig(Config):
    '''生产环境的配置信息'''
    REDIS_HOST = ''
    REDIS_PORT = 3306


config_map = {
    'develop' : DevConfig,
    'product' : ProductConfig
}